package com.example.demo.Service;

import com.example.demo.Mapper.CommentsMapper;
import com.example.demo.Model.CommentsModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentsService {

    private final CommentsMapper dao;

    @Autowired
    public CommentsService(CommentsMapper dao) {
        this.dao = dao;
    }

    public boolean insert(CommentsModel model) {
        return dao.insert(model) > 0;
    }

    public List<CommentsModel> selectAll() {
        return dao.selectAll();
    }

    public boolean updateValue(CommentsModel model) {
        return dao.updateValue(model) > 0;
    }

    public boolean delete(Integer id) {
        return dao.delete(id) > 0;
    }
}